package com.java80.springmall.cloud.product.provider.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.codingapi.tx.annotation.TxTransaction;
import com.java80.springmall.cloud.product.provider.entity.Product;
import com.java80.springmall.cloud.product.provider.repository.ProductRepository;
import com.java80.springmall.cloud.product.provider.service.ProductService;
@Service
public class ProductServiceImpl implements ProductService {
	@Autowired
	private ProductRepository productRepository;
	@Override
	public List<Product> findAll() {
		return productRepository.findAll();
	}

	@Override
	public Product get(long productId) {
		return productRepository.findOne(productId);
	}
	@Transactional
    @TxTransaction
	@Override
	public int updateStored(long productId, int nums) {
		return productRepository.updateStored(productId, nums);
	}

}
